const express = require('express');
const router = express.Router();

const data = require('../data');

router.get('/getletter', (req, res) => {
    let {userID} = req.query;
    // 检查分区是否为空
    if (!userID
        || typeof userID != "number") {
        res.json({
            err: 1,
            message: '用户ID为空'
        })
    } else {
        // 下方改数据库操作代码
        res.json({
            err: 200,
            userID: "001",
            userName: "aaa",
            letterList:[
                {
                    sendUserID: 1,
                    sendUserName: "zhang",
                    content: "wbwb",
                    sendTime: 19700101
                },{
                    sendUserID: 11,
                    sendUserName: "zhang",
                    content: "wbbb",
                    sendTime: 19700230
                }

            ]
        })
    }
})

module.exports = router;